package model

import (
	"time"

	"gorm.io/gorm"
)

// MessageRole 消息角色枚举
const (
	MessageRoleUser      = "user"
	MessageRoleAssistant = "assistant"
	MessageRoleSystem    = "system"
)

// Message 消息模型
type Message struct {
	gorm.Model
	ConversationID uint   `gorm:"index:idx_conversation_id" json:"conversation_id"`
	UserID         uint   `gorm:"index:idx_user_id" json:"user_id"`
	Role           string `gorm:"size:20;not null" json:"role"` // user, assistant, system
	Content        string `gorm:"type:text;not null" json:"content"`
}

// Conversation 对话模型
type Conversation struct {
	gorm.Model
	UserID    uint      `gorm:"index:idx_user_id" json:"user_id"`
	Title     string    `gorm:"size:255" json:"title"`
	IsActive  bool      `gorm:"default:true" json:"is_active"`
	LastActive time.Time `gorm:"autoUpdateTime" json:"last_active"`
}

// FunctionCall Function Call定义
type FunctionCall struct {
	Name      string                 `json:"name,omitempty"`
	Arguments map[string]interface{} `json:"arguments,omitempty"`
}

// FunctionCallResponse Function Call响应
type FunctionCallResponse struct {
	Name     string `json:"name"`
	Response string `json:"response"`
}

// FunctionDefinition 函数定义
type FunctionDefinition struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Parameters  map[string]interface{} `json:"parameters"`
}